package com.encryption.feature.user.ui.render
{
	import com.encryption.rpc.cache.DepartmentManager;
	import com.encryption.rpc.model.Department;
	import com.encryption.rpc.model.User;
	
	import mx.controls.Label;
	
	public class UserDepartItemRenderer extends Label
	{
		private var _user:User;
		
		public function UserDepartItemRenderer()
		{
			super();
		}
		
		override public function set data(value:Object):void
		{
			this._user = value as User;
			
			if(_user != null){
				var depart:int = _user.department;
				
				DepartmentManager.instance.addInitListener(function():void{
					var departObj:Department = DepartmentManager.instance.getById(depart) as Department;
					text = departObj != null ? departObj.toString() : "";
				});
			}
		}
	}
}